home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
crt
/
sun4.md
/
RCS
/
start.s,v
< prev
Wrap
Text File
|
1989-07-31
|
3KB
|
114 lines
head 1.2;
branch ;
access ;
symbols ;
locks ; strict;
comment @| @;
1.2
date 89.03.26.20.19.51; author mgbaker; state Exp;
branches ;
next 1.1;
1.1
date 89.03.22.13.57.42; author mgbaker; state Exp;
branches ;
next ;
desc
@Initial copy of sun4 crt0.o (called start.s).
@
1.2
log
@Seventeenth Kernel. It executes its first system call: Sys_Shutdown().
@
text
@/*
* start.s --
*
* Crt0 for sun4. This is the header that sets up argc, argv and envp
* for main() and then jumps there. It also initializes the values
* of certain registers.
*
* Copyright 1989 Regents of the University of California
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*/
#include <kernel/machConst.h>
.seg "data"
.asciz "$Header: /sprite/src/lib/c/crt/sun4.md/RCS/start.s,v 1.1 89/03/22 13:57:42 mgbaker Exp Locker: mgbaker $ SPRITE (Berkeley)"
.align 4
.globl _environ
_environ:
.word 0xffffffff
.align 8
.seg "text"
.globl start
/*
* The stack pointer should be double-word aligned when it gets here. At
* MACH_FULL_STACK_FRAME beneath it lies the user stack put together in
* DoExec(). At the top of this is the argc integer. Below that is the argv
* stuff and below that is the
* environment stuff.
*/
start:
/*
* Argc is the first word on the top of the stack (top == lowest addr).
* This is followed immediately by the array of pointers to arguments
* (argv) and this is followed immediately by the array of pointers to
* the environment (envp). We must calculate the address of envp by
* using the number of arguments given in argc.
* environ = (char *) argv + (argc + 1) * 4.
* And argv = top of stack plus sizeof (Address).
*/
mov %sp, %VOL_TEMP1
add %VOL_TEMP1, MACH_FULL_STACK_FRAME, %VOL_TEMP1
ld [%VOL_TEMP1], %o0 /* argc */
add %VOL_TEMP1, 4, %o1 /* argv pointer */
add %o0, 1, %o2
sll %o2, 2, %o2
add %o2, %o1, %o2 /* envp pointer */
set _environ, %o3
st %o2, [%o3] /* store addr of env into environ */
/* Mark last stack frame so debugger can tell bottom of stack. */
clr %fp
/* Off to main routine with arguments argc, argv, envp */
call _main, 3
nop
call _exit
nop
@
1.1
log
@Initial revision
@
text
@d19 1
a19 1
.asciz "$Header: /sprite/lib/forms/sun4.md/RCS/proto.s,v 1.1 89/01/16 20:38:17 mgbaker Exp Locker: mgbaker $ SPRITE (Berkeley)"
a20 1
d23 1
a23 1
.skip 4
d47 1
a47 1
mov %fp, %VOL_TEMP1
@